import { createRouter, createWebHistory } from 'vue-router'
import HomePage from '../views/home_page/HomePage.vue'
import RegisterRouter from '@/router/register'
import AdminRouter from '@/router/admin'

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomePage
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/LoginView.vue')
  },
  {
    path: '/forget',
    name: 'forget',
    component: () => import('../views/ForgetPassword.vue')
  },
  {
    path: '/self',
    name: 'self',
    component: () => import('../views/self_service/HomePage.vue'),
    meta: {
      requireAuth: true
    }
  },
  {
    path: '/operation/:defaultActive',
    name: 'operation',
    component: () => import('../views/home_page/OperationIns.vue')
  },
  {
    path: '/GreenChannel',
    name: 'GreenChannel',
    component: () => import('../views/self_service/GreenChannel.vue')
  },
  {
    path: '/MentalTest',
    name: 'MentalTest',
    component: () => import('../views/self_service/MentalTest.vue')
  },
  {
    path: '/OnlinePay',
    name: 'OnlinePay',
    component: () => import('../views/self_service/OnlinePay.vue')
  },
  {
    path: '/:pathMatch(.*)*',
    component: () => import('@/views/error/NotFound.vue')
  },
  ...RegisterRouter,
  ...AdminRouter
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router
